package ypmits.components {
	import flash.display.ShaderParameter;

	import ypmits.pixelbender.PBJFilter;
	import ypmits.font.Arial;

	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.filters.BitmapFilter;
	import flash.filters.DropShadowFilter;
	import flash.text.AntiAliasType;
	import flash.text.GridFitType;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;

	/**
	 * @author Dave Lenz
	 */
	public class ComponentSkin {

		private var _width : Number = 100;
		private var _height : Number = 22;

		public var name : String = "";
		public var roundvalue : Boolean;
		public var spacebetween : int;
		public var selectthroughtext : Boolean;
		public var thumbwidth : int = 10;
		public var color : uint = 0x000000;
		public var alpha : Number = 1;
		public var background : Boolean = false;
		public var backgroundcolor : uint = 0xFFFFFF;
		public var backgroundalpha : Number = 1;
		public var backgroundwidth : Number = 150;
		public var backgroundheight : Number = 22;
		public var size : int = 12;
		public var bold : Object = null;
		public var italic : Object = null;
		public var underline : Object = null;
		public var selectable : Boolean = false;
		public var text : String = null;
		public var textcolor : int = 0x000000;
		public var texturl : String = null;
		public var texttarget : String = null;
		public var textalign : String = TextFormatAlign.LEFT;
		public var leftmargin : Object = null;
		public var rightmargin : Object = null;
		public var displayAsPassword : Boolean = false;
		public var indent : Object = null;
		public var embedFonts : Boolean = false;
		public var type : String = TextFieldType.DYNAMIC;
		public var antialiastype : String = AntiAliasType.ADVANCED;
		public var gridfittype : String = GridFitType.PIXEL;
		public var restrict : String = "0-9 A-Z a-z";
		public var url : String = null;
		public var urlextension : String = null;
		public var fontname : String = null;
		public var leading : int = 0;
		public var filter : BitmapFilter = new DropShadowFilter( 4, 45, 0, .4, 4, 4, 1, 3, true );
		public var windowwidth : Number = 250;
		public var windowheight : Number = 350;
		public var autosize : String = TextFieldAutoSize.LEFT;
		public var border : Boolean = false;
		public var bordercolor : uint = 0;
		public var wordwrap : Boolean = false;
		public var multiline : Boolean = false;

		// scrollbar-specific
		public var stage : Stage;
		public var barwidth : int = 6;
		public var trackwidth : int = 6;
		public var extraflesh : int = 6;
		public var scrubber : Sprite;
		public var scrolltrack : Sprite;
		public var target : DisplayObject;
		public var drawlevel : DisplayObjectContainer;
		public var maxScrollY : Number = 100;
		public var xoffset : Number = 8;
		public var topBottomGradient : Boolean = true;
		public var topBottomGradientOutside : Boolean = true;
		public var topBottomGradientOutsideFactor : Number = 15;
		public var useMouseWheel : Boolean = true;
		public var password : Boolean = false;
		public var thumbcolor : uint = 0xFFFFFF;
		public var rotation : int = 0;
		
		// other
		public var showvalue : Boolean;
		
		// modal
		public var clickanywheretoclose : Boolean;
		
		// slider
		public var func : Function = null;
		public var minimumvalue : Number = 0;
		public var maximumvalue : Number = 1;
		public var defaultvalue : Number = 0;
		public var interactive : Boolean = false;
		public var pbjfilter : PBJFilter;
		public var shader : ShaderParameter;
		public var arrayindex : int;

		
		
		public function get format() : TextFormat {
			if( embedFonts ) {
				if( !fontname ) {
					fontname = new Arial().fontName;
				} else {
					fontname = "_sans";
				}
			} else {
				fontname = "_sans";
			}
			return new TextFormat( fontname, size, textcolor, bold, italic, underline, texturl, texttarget, textalign, leftmargin, rightmargin, indent );
		}

		
		public function ComponentSkin() {
			validate( );
		}

		
		public function validate() : void 
		{
		}
		
		
		
		public function get width() : Number
		{
			return _width;
		}
		
		
		
		public function get height() : Number
		{
			// TODO: Auto-generated method stub
			return _height;
		}
		
		
		
		public function set width(value : Number) : void {
			_width = value;
		}
		
		
		
		public function set height(value : Number) : void {
			_height = value;
		}
	}
}
